package template;

public abstract class CaffeineBeverage {
    public final void prepareRecipe() {
        boilWater();
        brew();
        pourInCup();
        addCondiments();
        if(pack())
            System.out.println("使用精美包装");
    }

    public abstract void brew();
    public abstract void addCondiments();

    public void boilWater() {
        System.out.println("将水煮沸腾");
    }
    public void pourInCup() {
        System.out.println("将饮品倒入杯中");
    }
    // 钩子函数，是否打包
    public boolean pack() {
        return false;
    }
}
